﻿@using UtilsORM.MySqlData;
@{
    ViewBag.PageTitle = "洪峰智能";

    Layout = "~/Views/Shared/PageTemplate.cshtml";
}
<link rel="stylesheet" href="/zTree_v3/css/demo.css?1=1" type="text/css" />
<link rel="stylesheet" href="/zTree_v3/css/zTreeStyle/zTreeStyle.css?1=1" type="text/css" />
<script type="text/javascript" src="/zTree_v3/js/jquery-1.4.4.min.js?1=1"></script>
<script type="text/javascript" src="/zTree_v3/js/jquery.ztree.core.js?1=1"></script>
<script src="/zTree_v3/js/jquery.ztree.all.min.js?1=1"></script>
<script src="/zTree_v3/js/jquery.ztree.exhide.js?1=1"></script>
<script src="/zTree_v3/js/fuzzysearch.js?1=555dd833555781"></script>


<style>
    html, body {
        height: 100%;
        margin: 0px;
        padding: 0px;
    }

    .nodecss {
        color: #ccc;
    }
</style>

<SCRIPT type="text/javascript">
    var setting = {
        data: {
            simpleData: {
                enable: true,
            }
        },
        check: {
            enable: false
        },
        view: {
            nameIsHTML: true, //允许name支持html
            selectedMulti: false
        },
        edit: {
            enable: false,
            editNameSelectAll: false
        },
        async: {
            //异步加载
            enable: true,
            url: "ListZTreeData",
            contentType: "text/plain",
            type: "get",
            autoParam: ["id"]
        },
        callback: {
            beforeMouseDown: MouseDownEvent,//鼠标点击发生的事
            onAsyncSuccess: zTreeOnAsyncSuccess
        }
    };
    function zTreeOnAsyncSuccess(event, treeId, treeNode, msg) {
        // alert(msg);
    }


    var zNodes = [
        { id: 234, pId: 23, name: "叶子节点234" },
        { id: 3, pId: 0, name: "父节点3 - 没有子节点", isParent: true }
    ];

    $(document).ready(function () {

        createTree();




    });

    function createTree() {

        $.ajax({
            url: 'ListZTreeData?p_guid='+$("#p_guid").val(), //url  action是方法的名称
            data: { id: "" },
            type: 'Post',
            dataType: "json", //可以是text，如果用text，返回的结果为字符串；如果需要json格式的，可是设置为json
            success: function (data) {
                $.fn.zTree.init($("#treeDemo"), setting, data);

                setTimeout("fuzzySearch('treeDemo', '#key', null, true)", 1000);


                //初始化模糊搜索方法
            },
            error: function (msg) {
                // alert(" 数据加载失败！" + msg);
            }
        });
    }
    function MouseDownEvent(treeId, treeNode) {
        if (treeNode == null || treeNode.id == null) {
            return;
        }
        var guid = treeNode.id;

        // window.frames["iframe_list"].document.getElementById('txt_Search_Name').value = "";
        //  window.frames["iframe_list"].document.getElementById('hid_id').value = pty_guid;


        document.getElementById("iframe_list").src = "list?gwdguid=" + guid + "&p_guid=" + $("#p_guid").val();
    }

    function onreload() {
        window.location.href = window.location.href;
    }
</SCRIPT>

<input type="hidden" name="p_guid" id="p_guid" value="@(((iot_product)ViewData["reqProduct"]).p_guid)" />
<div style="width:200px;float:left;margin-right:10px;padding:0px;height:100%">
    <div style="line-height:25px;text-align:center;border:1px solid #e2e0e0; border-radius:5px;font-weight:bold;color:#808080">
        请选择网关
    </div>
    <div style="padding:5px;background-color:#f0f6e4">
        搜索：<input type="text" id="key" class="empty" style="width: 100px;margin-left: 3px;font-weight: normal;" placeholder="名称" />
    </div>
    <div style="clear:both"></div>
    <div class="content_wrap" style="height:calc(100% - 90px)">
        <div class="zTreeDemoBackground left" style="height:100%">
            <ul id="treeDemo" class="ztree" style="width:190px;height:100%"></ul>
        </div>
    </div>
</div>
<div style="overflow:hidden;height:100%">
    <iframe src="list?p_guid=@(((iot_product)ViewData["reqProduct"]).p_guid)" id="iframe_list" name="iframe_list" style="width:100%;height:100%"></iframe>
</div>
